home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 501-525 / disk_519 / avlsort / avl / avl.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  1KB  |  61 lines

  1. /*    avl.h        Definitions for avl routines
  2.  
  3.     Copyright 1988 Zinn Computer Company
  4.             by Mark E. Mallett
  5.  
  6.     All Rights Reserved
  7.     All rights reserved;
  8.     This software may be used at will, provided that all credits
  9. and style be left in place, and that its distribution is not restricted.
  10. Bug fixes and improvements are welcomed, please send these back to
  11. me at mem@zinn.MV.COM
  12.  
  13.  
  14. */
  15.  
  16. #ifndef    H_AVL                /* Prevent multiple inclusions */
  17. #define    H_AVL
  18.  
  19. #ifndef    TRUE                /* Same old jazz */
  20. #define    TRUE    1
  21. #define    FALSE    0
  22. #endif    TRUE
  23.  
  24. #ifndef    NULL
  25. #define    NULL    ((char *)0)
  26. #endif    NULL
  27.  
  28. #ifndef    NUL
  29. #define    NUL    '\0'
  30. #endif    NUL
  31.  
  32.     /* Structures */
  33.  
  34. /* Structure of an avl tree node.  Note that this node is meant to
  35.    be used as a header or component of an application-specific structure,
  36.    since there is no key or data information present in the avlnode
  37.    structure.
  38. */
  39.  
  40. typedef                    /* A node in an AVL tree */
  41.   struct avlnode {
  42.     struct avlnode *n_leftP;        /* Ptr to left subtree */
  43.     struct avlnode *n_rightP;        /* Ptr to right subtree */
  44.     int        n_balance;        /* Balance count */
  45.   } AVLNODE;
  46.  
  47.  
  48. typedef                    /* The header for an AVL tree */
  49.   struct {
  50.     /* Tree parameters */
  51.     AVLNODE    *t_rootP;        /* Ptr to root node */
  52.  
  53.     /* Handler functions for the tree */
  54.     int        (*t_cmprtc)();        /* Compare two keys */
  55.     AVLNODE    *(*t_mknode)();        /* Node maker */
  56.     int        (*t_rmnode)();        /* Node destroyer */
  57.   } AVLTREE;
  58.  
  59.  
  60. #endif    H_AVL;
  61.